package day32;

import java.util.Scanner;

/**
 * @author tongchen
 * @create 2023-04-10 23:34
 */
public class Main {
    public static void main(String[] args) {
        //创建输入
        Scanner scanner=new Scanner(System.in);
        while(scanner.hasNext()){
            int year=scanner.nextInt();
            int month=scanner.nextInt();
            int day=scanner.nextInt();
            int year1=scanner.nextInt();
            int month1=scanner.nextInt();
            int day1=scanner.nextInt();
            int profit=0;
          //判断是否为同一年
            profit=profitOfYear(year)-profitOfThisYear(year, month, day-1);
            profit+=profitOfThisYear(year1, month1, day1);
            if(year==year1){
                profit-=profitOfYear(year);
            }
            else{
                for(int i=year+1;i<year1;++i){
                    profit+=profitOfYear(i);

                }
            }
            System.out.println(profit);
        }

    }
    //判断每一年的利润
    public static int profitOfYear(int year){
       return 2 * 31
                + 1 * 28
                + 1 * 31
                + 2 * 30
                + 1 * 31
                + 2 * 30
                + 1 * 31
                + 2 * 31
                + 2 * 30
                + 2 * 31
                + 1 * 30
                + 2 * 31+(isRun(year)?1:0);
    }
    //判断当前年的利润
    public static int profitOfThisYear(int year,int month,int day){
        int profit=0;
        if(isPrime(month)){
            profit=day;
        }else{
            profit=2*day;
        }
        while(--month>0){
            switch (month){
                case 1: case 8: case 10:
                    profit+=62;
                    break;
                case 3: case 5: case 7:
                    profit+=31;
                    break;
                case 4: case  6: case 9:
                    profit+=60;
                    break;
                case 11:
                    profit+=30;
                    break;
                case 2:
                    profit+=(28+(isRun(year)?1:0));
                    break;
            }

        }
        return profit;
    }
    //判断是否为闰月
    private static boolean isPrime(int month) {
        return month == 2 || month == 3 || month == 5 || month == 7 || month == 11;
    }
    //判断是否是闰年
    private static boolean isRun(int year) {
        return year % 400 == 0 || (year % 4 == 0 && year % 100 != 0);
    }


    //创建每个月的钱数
}
